package com.crm.web.controller.clue;

import com.crm.common.core.controller.BaseController;
import com.crm.common.core.domain.AjaxResult;
import com.crm.common.core.domain.entity.SysUser;
import com.crm.common.core.page.TableDataInfo;
import com.crm.domain.vo.TransferVo;
import com.crm.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/transfer")
public class TransferController extends BaseController {
    @Autowired
    private TransferService transferService;
    /**
     * 分页展示转派列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SysUser user) {
        startPage();
        List<TransferVo> transferList =transferService.selectTransferList(user);
        return getDataTable(transferList);
    }

    /**
     * 转派处理
     *
     */
    @PutMapping("/assignment/{type}/{userId}/{transferUserId}")
    public AjaxResult assignment(@PathVariable("type") String type,@PathVariable("userId") Long userId,@PathVariable("transferUserId") Long transferUserId){
        return AjaxResult.success(transferService.assignment(type,userId,transferUserId));
    }
}
